/*
 * Copyright (C) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <cstdio>
#include <iostream>
#include <atomic>
#include <fstream>
#include <mutex>
#include <queue>
#include <string>
#include <thread>

#include "gtest/gtest.h"
#include "videodec_sample.h"
#include "native_avcodec_base.h"
#include "avcodec_codec_name.h"
#include "native_avcapability.h"
#include "videodec_api11_sample.h"
#include "native_avcodec_videodecoder.h"
#include "native_averrors.h"
#include "native_avformat.h"
using namespace std;
using namespace OHOS;
using namespace OHOS::Media;
using namespace testing::ext;
namespace OHOS {
namespace Media {
class MjpegSwdecStateNdkTest : public testing::Test {
public:
    // SetUpTestCase: Called before all test cases
    static void SetUpTestCase(void);
    // TearDownTestCase: Called after all test case
    static void TearDownTestCase(void);
    // SetUp: Called before each test cases
    void SetUp(void);
    // TearDown: Called after each test cases
    void TearDown(void);

protected:
    const ::testing::TestInfo *testInfo_ = nullptr;
    bool createCodecSuccess_ = false;
    OH_AVCapability *cap = nullptr;
};

void MjpegSwdecStateNdkTest::SetUpTestCase(void) {}

void MjpegSwdecStateNdkTest::TearDownTestCase(void) {}

VDecAPI11Sample *vDecSample = NULL;
void MjpegSwdecStateNdkTest::SetUp(void)
{
    if (!access("/system/lib64/media/", 0)) {
        cap = OH_AVCodec_GetCapabilityByCategory("video/mjpeg", false, SOFTWARE);
        string mjpegCodeName = OH_AVCapability_GetName(cap);
        cout << "mjpegCodeName: " << mjpegCodeName << endl;
        vDecSample = new VDecAPI11Sample();
        int32_t ret = vDecSample->CreateVideoDecoder(mjpegCodeName);
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->INP_DIR = "/data/test/media/1920_1080_30.avi";
        const char *file = "/data/test/media/1920_1080_30.avi";
        vDecSample->getFormat(file);
    }
}

void MjpegSwdecStateNdkTest::TearDown(void)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->Release();
        delete vDecSample;
        vDecSample = nullptr;
    }
}
} // namespace Media
} // namespace OHOS

namespace {
/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0100
 * @tc.name      : create-configure-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0101
 * @tc.name      : create-configure-stop
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0101, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0200
 * @tc.name      : create-configure-start-stop-start
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0300
 * @tc.name      : create-configure-start-stop-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0400
 * @tc.name      : create-configure-start-stop-reset
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0500
 * @tc.name      : create-configure-start-stop-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0600
 * @tc.name      : create-configure-start-EOS-stop-start
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0700
 * @tc.name      : create-configure-start-EOS-stop-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0800
 * @tc.name      : create-configure-start-EOS-stop-reset
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_0900
 * @tc.name      : create-configure-start-EOS-flush
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_0900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1000
 * @tc.name      : create-configure-start-EOS-flush-start
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1100
 * @tc.name      : create-configure-start-EOS-flush-stop
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1200
 * @tc.name      : create-configure-start-EOS-flush-reset
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1300
 * @tc.name      : create-configure-start-EOS-flush-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_VAL, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1400
 * @tc.name      : create-configure-start-EOS-reset-configure
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1500
 * @tc.name      : create-configure-start-EOS-reset-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1600
 * @tc.name      : create-configure-start-EOS-reset-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ASSERT_EQ(0, vDecSample->errCount);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1700
 * @tc.name      : create-configure-start-flush-start-flush
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1800
 * @tc.name      : create-configure-start-flush-start-eos
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->state_EOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_1900
 * @tc.name      : create-configure-start-flush-start-stop
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_1900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2000
 * @tc.name      : create-configure-start-flush-start-reset
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2100
 * @tc.name      : create-configure-start-flush-start-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2200
 * @tc.name      : create-configure-start-flush-start-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        cout << "set callback" << endl;
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2300
 * @tc.name      : create-configure-start-flush-stop-start
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2400
 * @tc.name      : create-configure-start-flush-stop-reset
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2500
 * @tc.name      : create-configure-start-flush-stop-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2600
 * @tc.name      : create-configure-start-flush-reset-configure
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2700
 * @tc.name      : create-configure-start-flush-reset-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2800
 * @tc.name      : create-configure-start-flush-reset-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_2900
 * @tc.name      : create-configure-start-reset-configure
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_2900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3000
 * @tc.name      : create-configure-start-reset-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3100
 * @tc.name      : create-configure-start-reset-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3200
 * @tc.name      : create-configure-start-error
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3300
 * @tc.name      : create-configure-reset-configure
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3400
 * @tc.name      : create-configure-release
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        int32_t ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3500
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3500, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->inputCallbackFlush = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3600
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3600, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->inputCallbackStop = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3700
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3700, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->outputCallbackFlush = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3800
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3800, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->outputCallbackStop = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_3900
 * @tc.name      : Flush or stop in surf decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_3900, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->inputCallbackFlush = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4000
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4000, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->inputCallbackStop = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4100
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4100, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->outputCallbackFlush = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4200
 * @tc.name      : Flush or stop in buffe decoder callback function
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4200, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->outputCallbackStop = true;
        int32_t ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4300
 * @tc.name      : create-configure-start-EOS-stop-start-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4400
 * @tc.name      : create-configure-start-EOS-stop-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4500
 * @tc.name      : create-configure-start-EOS-stop-reset-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4600
 * @tc.name      : create-configure-start-EOS-flush-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4700
 * @tc.name      : create-configure-start-EOS-flush-start-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4800
 * @tc.name      : create-configure-start-EOS-flush-stop-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_4900
 * @tc.name      : create-configure-start-EOS-flush-reset-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_4900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5000
 * @tc.name      : create-configure-start-EOS-flush-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_VAL, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5100
 * @tc.name      : create-configure-start-EOS-reset-configure-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5200
 * @tc.name      : create-configure-start-EOS-reset-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5300
 * @tc.name      : create-configure-start-EOS-reset-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->StartVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5400
 * @tc.name      : create-configure-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5401
 * @tc.name      : create-configure-setsurface-stop
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5401, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5500
 * @tc.name      : create-configure-start-stop-start-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5600
 * @tc.name      : create-configure-start-stop-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5700
 * @tc.name      : create-configure-start-stop-reset-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5800
 * @tc.name      : create-configure-start-stop-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_5900
 * @tc.name      : create-configure-start-flush-start-flush-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_5900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6000
 * @tc.name      : create-configure-start-flush-start-eos-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->state_EOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6100
 * @tc.name      : create-configure-start-flush-start-stop-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6200
 * @tc.name      : create-configure-start-flush-start-reset-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6300
 * @tc.name      : create-configure-start-flush-start-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6400
 * @tc.name      : create-configure-start-flush-start-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        cout << "set callback" << endl;
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6500
 * @tc.name      : create-configure-start-flush-stop-start-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6600
 * @tc.name      : create-configure-start-flush-stop-reset-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6700
 * @tc.name      : create-configure-start-flush-stop-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6700, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6800
 * @tc.name      : create-configure-start-flush-reset-configure-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6800, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_6900
 * @tc.name      : create-configure-start-flush-reset-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_6900, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7000
 * @tc.name      : create-configure-start-flush-reset-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7000, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7100
 * @tc.name      : create-configure-start-reset-configure-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7100, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7200
 * @tc.name      : create-configure-start-reset-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7200, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7300
 * @tc.name      : create-configure-start-reset-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7300, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Stop();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->Flush();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7400
 * @tc.name      : create-configure-start-error-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7400, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Start();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_INVALID_STATE, ret);
        ret = vDecSample->SetVideoDecoderCallback();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7500
 * @tc.name      : create-configure-reset-configure-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7500, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Reset();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->ConfigureVideoDecoder();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7600
 * @tc.name      : create-configure-release-surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7600, TestSize.Level2)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        ret = vDecSample->Release();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7700
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7700, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->inputCallbackFlush = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7800
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7800, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->inputCallbackStop = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_7900
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_7900, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->outputCallbackFlush = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_8000
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_8000, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->outputCallbackStop = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_8100
 * @tc.name      : Flush or stop in surf decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_8100, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->inputCallbackFlush = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        vDecSample->WaitForEOS();
        ASSERT_EQ(AV_ERR_OK, ret);
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_8200
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_8200, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->inputCallbackStop = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_8300
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_8300, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->outputCallbackFlush = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}

/**
 * @tc.number    : VIDEO_MJPEGSWDEC_STATE_8400
 * @tc.name      : Flush or stop in buffe decoder callback function surface
 * @tc.desc      : state test
 */
HWTEST_F(MjpegSwdecStateNdkTest, VIDEO_MJPEGSWDEC_STATE_8400, TestSize.Level1)
{
    if (!access("/system/lib64/media/", 0)) {
        vDecSample->SF_OUTPUT = true;
        int32_t ret = vDecSample->DecodeSetSurface();
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->outputCallbackStop = true;
        ret = vDecSample->StartVideoDecoder();
        vDecSample->AFTER_EOS_DESTORY_CODEC = false;
        ASSERT_EQ(AV_ERR_OK, ret);
        vDecSample->WaitForEOS();
    }
}
} // namespace